﻿// -----------------------------------------------------------------------
// <copyright file="FriendSelector.cs" company="Hewlett-Packard">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace Ex3.FriendSelector
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using FacebookWrapper.ObjectModel;

    /// <summary>
    /// TODO: Update summary.
    /// </summary>
    public class Selector
    {
        private IStrategy m_Strategy;
        private List<User> m_AllUsersFriends;

        public Selector(IStrategy i_selectorStrategy, List<User> i_Friends)
        {
            this.m_Strategy = i_selectorStrategy;
            this.m_AllUsersFriends = i_Friends;
        }

        public List<User> GetFriends()
        {
            List<User> selectedFriends = new List<User>();
            foreach (User friend in this.m_AllUsersFriends)
            {
                if (m_Strategy.IsFriendWanted(friend))
                {
                    selectedFriends.Add(friend);
                }
            }

            return selectedFriends;
        }

        public void SetStrategy(IStrategy i_Strategy)
        {
            this.m_Strategy = i_Strategy;
        }
    }
}
